﻿<template>
    <el-dialog
        title="选择供应商"
        v-model="visible"
        :width="900"
        destroy-on-close
        :close-on-click-modal="false"
        :before-close="handleBeforeClose"
    >
        <el-form
            :model="entityObj"
            :rules="rules"
            :disabled="mode == 'Show'"
            ref="dialogForm"
            label-width="100px"
        >
            <el-row>
                <el-col :span="24">
                    <el-form-item label-width="110px" label="供应商列表">
                        <el-table :data="entityObj.purchaseProtocolItem" border style="width: 100%">
                            <el-table-column label="价格" width="150">
                                <template #default="scope">
                                    <el-input-number
                                        v-model="scope.row.price"
                                        style="width: 100%"
                                        :precision="2"
                                        :step="0.00"
                                        controls-position="right"
                                    ></el-input-number>
                                </template>
                            </el-table-column>
                            <el-table-column label="操作" min-width="80">
                                <template #default="scope">
                                    <el-button
                                        size="small"
                                        v-if="scope.$index<entityObj.deliveryProtocolItemPrices.length-1"
                                        @click="deleteRow(scope.$index, scope.row)"
                                    >移除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <template #footer>
            <el-button @click="handleBeforeClose">取 消</el-button>
            <el-button
                v-if="mode != 'show'"
                type="primary"
                :loading="isSaveing"
                @click="submit()"
            >保 存</el-button>
        </template>
    </el-dialog>
   
</template>



<script>
import tool from "@/utils/tool";
export default {
    emits: ["success", "closed"],
    data() {
        return {
            mode: "Add",
            titleMap: {
                Add: "新增",
                Edit: "编辑",
                Show: "查看",
            },
            materialItemId:0,
            
        };
    },
    computed: {},
    methods: {
        //显示=
        async open(mode = "Add") {
            this.mode = mode;
            this.visible = true;
            return this;
        },
        async setData(data) {
            console.log("选择供应商",data)
            this.materialItemId = data.materialItemId;
        },
    },
    async mounted() {},
};
</script>

<style></style>
